<%@ page language="java"
    pageEncoding="UTF-8"%>

<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Rice mall注册</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css"  />
		<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js" ></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" ></script>
<!-- 引入自定义css文件 style.css -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css"/>

<style>
  body{
   margin-top:20px;
   margin:0 auto;
 }
 .carousel-inner .item img{
	 width:100%;
	 height:300px;
 }
 .container .row div{ 
	 /* position:relative;
	 float:left; */
 }
 
font {
    color: #3164af;
    font-size: 18px;
    font-weight: normal;
    padding: 0 10px;
}
 </style>
</head>

	<script>
				//Jquery的页面载入事件
				$(function (){

					//获取id="img1"的jquery对象,同时设置点击事件
					$("#img1").click(function(){
						//alert("点击图片了") ;
							//改变图片的src属性="${pageContext.request.contextPath}/后台产生验证图片"
						/*
						* 点击之后,事件触发了,但是没有改变; 但是已经去产生一个四个随机数片,点击是图片刷新的时候图片信息缓存在浏览器中
						* 需要url?随机数
						* */
						this.src="${pageContext.request.contextPath}/checkCodeServlet?time="+new Date().getTime() ;
					}) ;


					//异步校验用户是否可用
					//获取id="username"的Jquery对象,触发失去焦点事件
					$("#username").blur(function(){

						//获取用户名(昵称)的内容
						var username = $(this).val() ;
						//获取id="tip"的span的jquery对象
						var span = $("#tip") ;

						//异步请求服务器校验用户名
						$.ajax({
							"url":"${pageContext.request.contextPath}/user?methodName=checkUser&username="+username,
							"type":"GET",
							"success":function(data){
									//data---服务器响应过来的json数据
								/**
								 * {
											code: 0/1,
											msg: "恭喜您,昵称可用/用户名太受欢迎,请更换"
										}
								 */
								if(data.code==1){
									//给span标签设置文本
									span.html(data.msg) ;
									//设置样式
									span.css("color","red") ;
								}else{
									//给span标签设置文本
									span.html(data.msg) ;
									//设置样式
									span.css("color","green") ;
								}
							},
							"dataType":"json"


						}) ;

					}) ;


				})	;


	</script>
<body>




			<%--静态包含--%>
			<%@include file="/jsp/header.jsp"%>





<div class="container" style="width:100%;background:url('${pageContext.request.contextPath}/image/regist_bg.jpg');">
<div class="row"> 

	<div class="col-md-2"></div>
	
	


	<div class="col-md-8" style="background:#fff;padding:40px 80px;margin:30px;border:7px solid #ccc;">
		<font>注册</font>REGISTER
		<form class="form-horizontal" style="margin-top:5px;" action="${pageContext.request.contextPath}/user?methodName=userRegister" method="post">
			 <div class="form-group">
			    <label for="username" class="col-sm-2 control-label">用户名</label>
			    <div class="col-sm-6">
			      <input type="text" class="form-control" name="username" id="username" placeholder="请输入用户名">
					<span id="tip"></span>
			    </div>
			  </div>

			   <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
			    <div class="col-sm-6">
			      <input type="password" class="form-control" name="password" id="inputPassword3" placeholder="请输入密码">
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="confirmpwd" class="col-sm-2 control-label">确认密码</label>
			    <div class="col-sm-6">
			      <input type="password" class="form-control" id="confirmpwd" placeholder="请输入确认密码">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
			    <div class="col-sm-6">
			      <input type="email" class="form-control" name="email" id="inputEmail3" placeholder="Email">
			    </div>
			  </div>
			 <div class="form-group">
			    <label for="usercaption" class="col-sm-2 control-label">姓名</label>
			    <div class="col-sm-6">
			      <input type="text" class="form-control" name="name" id="usercaption" placeholder="请输入姓名">
			    </div>
			  </div>
			  <div class="form-group opt">  
			  <label for="inlineRadio1" class="col-sm-2 control-label">性别</label>  
			  <div class="col-sm-6">
			    <label class="radio-inline">
			  <input type="radio" name="sex"  id="inlineRadio1" value="1"> 男
			</label>
			<label class="radio-inline">
			  <input type="radio" name="sex" id="inlineRadio2" value="2"> 女
			</label>
			</div>
			  </div>		
			  <div class="form-group">
			    <label for="birthday" class="col-sm-2 control-label">出生日期</label>
			    <div class="col-sm-6">
			      <input type="date" id="birthday" name="birthday" class="form-control"  >
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="code" class="col-sm-2 control-label">验证码</label>
			    <div class="col-sm-3">
			      <input type="text" id="code" name="code" class="form-control"  >
			      
			    </div>
			    <div class="col-sm-2">
			  <%--  <img src="${pageContext.request.contextPath}/image/captcha.jhtml"/>--%>
			    <img id="img1" src="${pageContext.request.contextPath}/checkCodeServlet"/>
			    </div>
			    
			  </div>
			 
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <input type="submit"  width="100" value="立即注册" name="submit" border="0"
				    style="background: url('${pageContext.request.contextPath}/image/register.gif') no-repeat scroll 0 0 rgba(0, 0, 0, 0);
				    height:35px;width:100px;color:#000;background-color:#F7BE81">
			    </div>
			  </div>
			</form>
	</div>
	
	<div class="col-md-2"></div>
  
</div>
</div>



			<!--
                        描述：页脚部分
                    -->
			<div class="container-fluid">

				<div style="float: left;margin-left: 30px;margin-top: 25px">
					<img src="${pageContext.request.contextPath}/image/logo-mi2.png" width="80px" height="80px">
				</div>
				<div style="text-align: center;margin-top: 5px;float: left;margin-left: 30px;margin-top: 50px;text-align: center" >
					<ul class="list-inline">
						<li><a href="info.html">小米商城</a></li>|
						<li><a>MIUI</a></li>|
						<li><a>米家</a></li>|
						<li><a>多看</a></li>|
						<li><a>游戏</a></li>|
						<li><a>政企服务</a></li>|
						<li><a>小米天猫店</a></li>|
						<li><a>小米集团隐私政策</a></li>|
						<li><a>小米公司儿童信息保护规则</a></li>|
						<li><a>米家隐私</a></li>|
						<li><a>问题反馈</a></li>|
						<li><a>招贤纳士</a></li>|
						<li><a>投诉建议</a></li>
					</ul>
				</div>
				<div style="clear: both"></div>
				<div  style="text-align: center;margin-top: 5px;margin-bottom:20px;">

					Copyright &copy;2020-2030  Rice mall
				</div>
			</div>

</body></html>




